using System;
using System.Collections.Generic;
using System.Text;
using System.IO;
using System.ComponentModel;

namespace XnaDevRu.ContentBuilder.Framework
{
	/// <summary>
	/// Represents content file.
	/// </summary>
    public class ContentFile
    {
        private string _outName;
        private string _name;
        private string _imp;
        private string _proc;
        private string _fullPath;

		/// <summary>
		/// Initializes a new instance of the content file.
		/// </summary>
		/// <param name="fullPath">Full path to the content file.</param>
        public ContentFile(string fullPath)
        {
            _fullPath = fullPath;
            FileInfo fi = new FileInfo(_fullPath);
            _name = fi.Name;
            _outName = fi.Name.Replace(fi.Extension, "");
        }

        /// <summary>
		/// Gets name of the content file.
        /// </summary>
        [Category("XNA Content Pipeline")]
        [DisplayName("File Name")]
        [Description("Name of the content file.")]
        [ReadOnly(true)]
        public string Name { get { return _name; } }

		/// <summary>
		/// Gets or sets location of the content file.
		/// </summary>
        [Category("XNA Content Pipeline")]
        [DisplayName("Full Path")]
        [Description("Location of the content file.")]
        [ReadOnly(true)]
        public string FullPath
        {
            get { return _fullPath; }
            set
            {
                _fullPath = value;
                FileInfo fi = new FileInfo(_fullPath);
                _name = fi.Name;
                _outName = fi.Name.Replace(fi.Extension, "");
            }
        }

		/// <summary>
		/// Gets or sets the name that will be used to reference this content at runtime.
		/// </summary>
        [Category("XNA Content Pipeline")]
        [DisplayName("Asset Name")]
        [Description("The name that will be used to reference this content at runtime.")]
        public string OutputName { get { return _outName; } set { _outName = value; } }

		/// <summary>
		/// Gets or sets the importer used for this piece of content during the build process.
		/// </summary>
        [Category("XNA Content Pipeline")]
        [DisplayName("Content Importer")]
        [Description("The importer used for this piece of content during the build process.")]
        [TypeConverter(typeof(ImporterConverter))]
        public string Importer { get { return _imp; } set { _imp = value; } }

		/// <summary>
		/// Gets or sets the processor used for this piece of content during the build process.
		/// </summary>
        [Category("XNA Content Pipeline")]
        [DisplayName("Content Processor")]
        [Description("The processor used for this piece of content during the build process.")]
        [TypeConverter(typeof(ProcessorConverter))]
        public string Processor { get { return _proc; } set { _proc = value; } }

		/// <summary>
		/// Returns name of the content file.
		/// </summary>
		/// <returns>Name of the content file.</returns>
        public override string ToString()
        {
            return _name;
        }
    }
}
